///@file Vector.h
///@brief Declaration of the class representing a Polynomial
///@author Arnaud Duval
///@version 0.0
///@date 2009/02/04


#ifndef POLYNOMIAL_H
#define POLYNOMIAL_H

#include <assert.h>
#include <iostream>


///@class Polynomial
///@brief Class defining a Polynomial
/// A polynomial is an array of coefficients
class Polynomial
{
	private:
		///@brief Degree of polynomial
		unsigned int degree;
		///@brief Array of coefficients;
		double *a;
	public:
		///@brief Default constructor
		Polynomial();
		///@brief Constructor precising the degree of the polynomial
		Polynomial(int);
		///@brief Constructor of specific polynomial
		Polynomial(int, char);
		///@brief Copy constructor
		Polynomial(const Polynomial &);
		///@brief Copy constructor for temporary object
		Polynomial(Polynomial*);
		///@brief Destructor
		~Polynomial();
		///@brief Overload of = operator
		Polynomial& operator=(const Polynomial &);
		///@brief Overload of = operator for temporary object
		Polynomial& operator=(Polynomial*);
		///@brief Overload of &= operator : copy without size check
		Polynomial& operator&=(const Polynomial &);
		///@brief Overload of [] operator
		double& operator[](unsigned int) const;
		///@brief Evaluate polynomial value
		double Evaluate(double);
		///@brief Return string with polynomial expression
		std::string Expression(std::string);

		///@brief Overload of * operator : product polynomial-scalar
		friend Polynomial operator * (const Polynomial&, const double&);
		///@brief Overload of * operator : product scalar-polynomial
		friend Polynomial operator * (const double& ,const Polynomial&);
		///@brief Overload of * operator : product polynomial-polynomial
		friend Polynomial operator * (const Polynomial&, const Polynomial&);
		///@brief Overload of + operator
		friend Polynomial operator + (const Polynomial&, const Polynomial&);
		///@brief Overload of - operator
		friend Polynomial operator - (const Polynomial&, const Polynomial&);
		///@brief Overload of << operator
		friend std::ostream& operator<<(std::ostream &, const Polynomial&);

};

#endif